package com.lxs.legou.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lxs.legou.core.po.BaseEntity;
import com.lxs.legou.core.service.impl.CrudServiceImpl;
import com.lxs.legou.order.config.MqConfig;
import com.lxs.legou.order.dao.AddressDao;
import com.lxs.legou.order.po.Address;
import com.lxs.legou.order.po.Order;
import com.lxs.legou.order.service.AddressService;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import org.springframework.amqp.core.Exchange;
import org.springframework.aop.framework.ProxyFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: Mcb
 * @Date: 2022/1/19 23:33
 * @Description:
 */
@Service
public class AddressServiceImpl extends CrudServiceImpl<Address> implements AddressService {

    @Override
    public List<Address> list(Address entity) {
        //根据用户名查询收货地址
        QueryWrapper<Address> queryWrapper = Wrappers.<Address>query();
        if (StringUtils.isNotBlank(entity.getUsername())){
            queryWrapper.eq("username_",entity.getUsername());
        }

        return getBaseMapper().selectList(queryWrapper);
    }
}
